//
//  BKOrderAction.m
//  bestkeep
//
//  Created by 马乾征 on 16/11/4.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "BKOrderAction.h"
#import "BK_Confirm_Order_VC.h"
#import "BKOrderPaymentViewController.h"
#import "BKOrderDeliveryDateViewController.h"
#import "BKODWXManager.h"
#import "BKODAliManager.h"
@implementation BKOrderAction
/**
    发货日期
 */
- (UIViewController *)BKOrder_deliveryDateViewControllerWithParameter:(NSDictionary *)parameter
{
    BKOrderDeliveryDateViewController *deliveryDateViewController = [[BKOrderDeliveryDateViewController alloc] init];
    
    NSDictionary *paramDic = parameter[@"parameter"];
    
    deliveryDateViewController.levelLimit = paramDic[@"levelLimit"];
    deliveryDateViewController.reserveId = paramDic[@"reserveId"];
    deliveryDateViewController.orderInfo = paramDic[@"orderInfo"];
    return deliveryDateViewController;
}

/**
    提交订单
 */
- (UIViewController *)BKOrder_orderViewControllerWithParameter:(NSDictionary *)parameter
{
    BK_Confirm_Order_VC *orderViewController = [[BK_Confirm_Order_VC alloc] init];
    NSDictionary *paramDic = parameter[@"parameter"];
    orderViewController.arr_order = paramDic[@"orderInfo"];
    return orderViewController;
}

/**
    订单付款
 */

- (UIViewController *)BKOrder_paymentViewControllerWithParameter:(NSDictionary *)parameter
{
    BKOrderPaymentViewController *paymentViewController = [[BKOrderPaymentViewController alloc] init];
    NSDictionary *paramDic = parameter[@"parameter"];
    
    paymentViewController.globalStatus = paramDic[@"globalStatus"];
    paymentViewController.orderNumber = paramDic[@"orderNumber"];

    return paymentViewController;
}

/**
    微信 open url
 */
- (NSString *)BKOrder_WXHandleOpenUrl:(NSDictionary *)resultDic
{
    
    NSURL *url = resultDic[@"parameter"];
    [[BKODWXManager manager] handleOpenUrl:url];
    return @"WXPay";
}

/**
    支付宝 open url
 */

- (NSString *)BKOrder_AliHandleOpenUrl:(NSDictionary *)parameter
{
    NSURL *url = parameter[@"parameter"];
    [[BKODAliManager manager] paymentResultWithOpenUrl:url];
    return @"AliPay";
}

//- (NSString *)BKOrder_AliHandleDidFinishLaunching:(NSDictionary *)parameter
//{
//    NSDictionary *dic = parameter[@"parameter"];
//    [[BKODAliManager manager] orderPaymentResultWithDidFinishLaunching:dic];
//    return @"AliPay";
//}

@end
